package org.advanced.reflection;

import java.lang.reflect.Method;

/**
 * @author John.zhang
 * @version Id: UserTest, v 1.0 2020/12/3 19:27 ZhiYong Exp $
 */

public class UserTest {

    public static void main(String[] args) throws Exception {

        Class<User> userClass = User.class;
        System.out.println(userClass.getName());
        System.out.println(userClass.getPackage());
        System.out.println(userClass.getClassLoader());
        System.out.println(userClass.getSuperclass());

        User userTarget = userClass.newInstance();
        Method userMethod = userClass.getDeclaredMethod("getUser");
        userMethod.invoke(userTarget);

    }

}
